package com.p7.framework.permission.shiro;

import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;

/**
 * 自定义过滤器，用户自定义classpath:shiro/shiro-shiro.properties文件，配置client.filter.chain.definitions属性
 * @ClassName: ClientShiroFilterFactoryBean 
 * @author yz
 * @date 2019年2月14日 下午3:31:35
 */
public class ClientShiroFilterFactoryBean extends ShiroFilterFactoryBean {

	@Override
	public void setFilterChainDefinitions(String definitions) {
		if (StringUtils.isBlank(definitions)) {
			return;
		}
		String[] chainDefinitionsArray = StringUtils.split(definitions, ";");
		for (String filter : chainDefinitionsArray) {
			String[] o = StringUtils.split(filter, "=");
			getFilterChainDefinitionMap().put(o[0], o[1]);
		}
	}

}
